<template>
  <div id="centreRight1">
    <div class="bg-color-black">
      <div class="d-flex pt-2 pl-2">
        <span style="color: #5cd9e8">
          <icon name="chart-line"></icon>
        </span>
        <div class="d-flex">
          <span class="fs-xl text mx-2">世界疫情确诊情况前十五</span>
        </div>
      </div>
      <div id="centreRightChart" style="width: 4.25rem; height: 8.2125rem"></div>
    </div>
  </div>
</template>

<script>
import echartMixins from "@/utils/resizeMixins";
export default {
  data() {
    return {
      chart: null,
    };
  },
  mixins: [echartMixins],
  mounted() {
    this.draw();
  },
  methods: {
    draw() {
      // 基于准备好的dom，初始化echarts实例
      this.chart = this.$echarts.init(
        document.getElementById("centreRightChart")
      );
      //  ----------------------------------------------------------------

      this.chart.setOption({
        color: [
          "#37a2da",
          "#32c5e9",
          "#9fe6b8",
          "#ffdb5c",
          "#ff9f7f",
          "#fb7293",
          "#e7bcf3",
          "#8378ea",
          "#123456",
          "#234567",
          "#819442",
          "#FF00FF",
          "#FF1493",
          "#FF0000",
          "#DC143C"
        ],
        tooltip: {
          trigger: "item",
          formatter: "{a} <br/>{b} : {c} ({d}%)",
        },
        toolbox: {
          show: true,
        },
        series: [
          {
            type: "pie",
            radius: [30, 560],
            roseType: "area",
            center: ["70%", "80%"],
            label: {
                position: 'inner',
                fontSize: 14,
            },
            data: [
              { value: 3101266, name: "墨西哥" },
              { value: 3828291, name: "德国" },
              { value: 3854354, name: "印度尼西亚" },
              { value: 4425821, name: "伊朗" },
              { value: 4440669, name: "意大利" },
              { value: 4693540, name: "西班牙" },
              { value: 4867761, name: "哥伦比亚" },
              { value: 5084635, name: "阿根廷" },
              { value: 6078623, name: "土耳其" },
              { value: 6297157, name: "英国" },
              { value: 6471262, name: "法国" },
              { value: 6511431, name: "俄罗斯" },
              { value: 20364099, name: "巴西" },
              { value: 32225513, name: "印度" },
              { value: 37466718, name: "美国" },
            ],
          },
        ],
      });
    },
  },
  destroyed() {
    window.onresize = null;
  },
};
</script>

<style lang="scss">
#centreRight1 {
  padding: 0.2rem;
  height: 5.125rem;
  min-width: 4.75rem;
  border-radius: 0.0625rem;
  .bg-color-black {
    height: 8.2125rem;
    border-radius: 0.125rem;
  }
  .text {
    color: #c3cbde;
  }
  .body-box {
    border-radius: 0.125rem;
    overflow: hidden;
  }
}
</style>